home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr01 / halcn305.zip / GSDMO_07.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-02  |  3KB  |  100 lines

  1. program GSDMO_07;
  2. {------------------------------------------------------------------------------
  3.                             DBase Memo File Lister
  4.  
  5.        Copyright (c)  Richard F. Griffin
  6.  
  7.        20 January 1993
  8.  
  9.        102 Molded Stone Pl
  10.        Warner Robins, GA  31088
  11.  
  12.        -------------------------------------------------------------
  13.        This program demonstrates how dBase memo records may be listed
  14.        using Griffin Solutions units.
  15.  
  16.        The program opens a dBase file GSDMO_07.DBF and proceeds to list
  17.        selected fields from each record along with its memo record.  If
  18.        the file does not exist it will be created in dBase IV format.
  19.  
  20.        New procedures/functions introduced are:
  21.  
  22.                  MemoGet
  23.                  MemoGetLine
  24.                  MemoLines
  25.                  MemoWidth
  26.  
  27. -------------------------------------------------------------------------------}
  28.  
  29. uses
  30.    GSOB_Gen,
  31.    GSOBShel,
  32.    {$IFDEF WINDOWS}
  33.       WinCRT,
  34.       WinDOS;
  35.    {$ELSE}
  36.       CRT,
  37.       DOS;
  38.    {$ENDIF}
  39.  
  40. var
  41.    CkFile  : file;
  42.    c       : char;
  43.    Shar    : boolean;
  44.  
  45.                      {Procedure to display the memo field}
  46.  
  47. procedure ShowTheMemo;
  48. var
  49.    i,
  50.    ml   : integer;
  51.  
  52. begin
  53.    MemoGet('COMMENTS');         {Load the COMMENTS memo into memory}
  54.    ml := MemoLines;             {Get the nummber of memo lines}
  55.    if ml <> 0 then
  56.       for i := 1 to ml do       {Get and write each memo line}
  57.          writeln(MemoGetLine(i))
  58.       else writeln('[ EMPTY ]');
  59.    writeln;
  60. end;
  61.  
  62.  
  63.                                {Main program}
  64. begin
  65.    ClrScr;
  66.  
  67.              {Ensure a dBase file with a memo exists.}
  68.              {A dBase III file with memo can be made }
  69.              {if the first argument of MakeTestData  }
  70.              {is changed from 4 to 3.  Refer to the  }
  71.              {GSOB_GEN.PAS listing.                  }
  72.  
  73.    if not FileExist('GSDMO_07.DBF') then
  74.    begin
  75.       writeln('Creating GSDMO_07.DBF');
  76.       MakeTestData(4,'GSDMO_07', 20, true);      {Make a dBase IV file}
  77.       writeln('GSDMO_07.DBF Created');
  78.       ClrScr;
  79.    end;
  80.  
  81.    SetCenturyOn;
  82.    Select(1);
  83.    Use('GSDMO_07');
  84.    MemoWidth(75);        {sets width of the memo line.  Default is 70}
  85.    GoTop;
  86.    while not dEOF do
  87.    begin
  88.       ClrScr;
  89.       writeln(FieldGet('LASTNAME'),', ',
  90.               FieldGet('FIRSTNAME'));
  91.       ShowTheMemo;
  92.       write('Press any key....');
  93.       c := ReadKey;
  94.       writeln;
  95.       Skip(1);
  96.    end;
  97.    CloseDataBases;
  98. end.
  99.  
  100.